<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>

  <style>
    h2 {
      text-align: center;
    }

    /* 合并相邻边框 */
    table {
      border-collapse: collapse;
      height: 80px;
      margin: 0 auto;
      text-align: center;
    }

    table,
    tr,
    th,
    td {
      border: 1px solid #000;
    }

    th {
      padding: 10px 30px;
    }

    td {
      padding: 10px 30px;
    }
  </style>
</head>

<body>



  <script>
    // 1.用户输入
    let price = parseFloat(prompt("请输入商品价格："));
    let num = parseFloat(prompt("请输入商品数量："));

    let address = prompt("请输入收货地址");

    // 2.计算总价
    let total = price * num;

    // 3.页面打印渲染
    document.write(`
      <h2>订单确认</h2>
      <table>
        <tr>
          <th>商品名称</th>
          <th>商品价格</th>
          <th>商品数量</th>
          <th>总价</th>
          <th>收获地址</th>
        </tr>
        <tr>
          <td>小米手机青春plus</td>
          <td>${price}元</td>
          <td>${num}</td>
          <td>${total}元</td>
          <td>${address}</td>
        </tr>
      </table>
    `)
  </script>
</body>

</html>